package com.example.teesystem.entity;

import com.baomidou.mybatisplus.annotation.*;

import java.io.Serializable;
import java.util.Date;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 
 * @TableName t_course_data
 */
@TableName(value ="t_course_data")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class CourseData implements Serializable {
    /**
     * key自增
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    /**
     * 课程id
     */
    @TableField(value = "course_id")
    private Integer courseId;

    /**
     * 上传者id
     */
    @TableField(value = "upload_id")
    private Integer uploadId;

    /**
     * 1：公开，0：不公开
     */
    @TableField(value = "is_public")
    private Integer isPublic;

    /**
     * 资料下载地址
     */
    @TableField(value = "url")
    private String url;

    /**
     * 标题
     */
    @TableField(value = "title")
    private String title;

    /**
     * 资料描述
     */
    @TableField(value = "message")
    private String message;

    /**
     * 0 未删除，1 已删除
     */
    @TableField(value = "is_delete")
    @TableLogic
    private Integer isDelete;

    /**
     * 上传时间
     */
    @TableField(value = "upload_time", fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date uploadTime;

    /**
     * 更新时间
     */
    @TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date updateTime;

    @TableField(value = "star")
    private Float star;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    public CourseData(Integer courseId, Integer isPublic, String title, String message){
        this.courseId =courseId;
        this.isPublic = isPublic;
        this.title = title;
        this.message = message;
    }
}